import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class FileDemo11 {
    public static void main(String[] args) throws IOException {
        try (InputStream inputStream = new FileInputStream("test.txt")){
            byte[] bytes = new byte[1024];
            while(true) {
                int len = inputStream.read(bytes);
                if(len == -1){
                    break;
                }
                for (int i = 0; i < len; i++) {
                    System.out.printf("%c",bytes[i]);
                }
            }
        }
    }
}
